package com.taxer.controller;

import com.taxer.contants.Constants;
import com.taxer.exception.TaxerExcepiton;
import com.taxer.result.Result;
import com.taxer.service.ProvinceService;
import com.taxer.db.entity.Province;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;


@Controller
@RequestMapping(value = "/province")
public class ProvinceController {
    @Resource
    private ProvinceService provinceService;
    @RequestMapping("/selectById")
    @ResponseBody
    public Result select(@RequestBody Province province){
        Result result = new Result();
        try {
            Byte id=province.getParentId();
            System.out.println(id);
            result.setData(provinceService.getParentByParId(id));
            result.setMessage("添加成功");

        }catch (TaxerExcepiton taxerExcepiton){
            result.setCode(Constants.RESP_STATUS_INTERNAL_ERROR);
            result.setMessage(taxerExcepiton.getMessage());
        }
        return result;
    }
}
